#ifndef BRUTUS_H
#define BRUTUS_H

#include "Sprite.h"
#include "Platform.h"
#include "Stair.h"
#include "Step.h"
#include "PlatformHolder.h"
#include "FrameRangeAnimation.h"
#include "FrameRangeAnimator.h"
#include "MovingAnimation.h"
#include "MovingAnimator.h"
#include "TimerTickAnimator.h"
#include "FlashingAnimation.h"
#include "FlashingAnimator.h"
#include "common.h"

class Brutus : public Sprite {
private:
	FrameRangeAnimation *walkAnimation, *punchUpAnimation, *punchDownAnimation;
	FrameRangeAnimator *walkAnimator, *punchUpAnimator, *punchDownAnimator;
	MovingAnimation *fallAnimation;
	MovingAnimator *fallAnimator;
	int velocity;
	int direction;
	TickAnimation *tickAnimation;
	TimerTickAnimator *timerTick;
	static void PunchCompleted(Animator*, void *closure);
	static void LookForPopeye(void *closure);
	static void StopWalking(Animator *animator, void *closure);
	bool goToPopeye;
	bool climbDown;
	bool climbUp;
	bool isHit;
	FlashingAnimation *flashAnimation;
	FlashingAnimator *flashAnimator;
	MovingAnimation *hitAnimation;
	MovingAnimator *hitAnimator;
	static void ResetStart(Animator *, void *closure);
	static void ResetEnd(Animator *, void *closure);
public:
	Brutus::Brutus(Dim _x, Dim _y, AnimationFilm* film,
		FrameRangeAnimation *_walkAnimation, FrameRangeAnimator *_walkAnimator,
		FrameRangeAnimation *_punchUpAnimation, FrameRangeAnimator *_punchUpAnimator,
		FrameRangeAnimation *_punchDownAnimation, FrameRangeAnimator *_punchDownAnimator,
		MovingAnimation *_fallAnimation, MovingAnimator *_fallAnimator);
	~Brutus(void);
	static void GenerateNextMove(void *closure);
	//Horizontal movement
	void MoveHorizontal(int dx);
	void StopMoving(void);
	virtual void Move(int dx, int dy);
	void Fall(int x);
	void NotifyStartFalling(void);
	void NotifyStopFalling(void);
	//Vertical movement
	void MoveUp(void);
	void MoveDown(void);
	void PunchUp(void);
	void PunchDown(void);
	bool isAbleToMove(void);
	bool falls(void);
	///sdasd
	virtual void ResetToDefaultFilm();
	void SetWalkFilm();
	void SetPunchUpFilm();
	void SetPunchDownFilm();
	void SetDiagonalClimbUpFilm();
	void SetDiagonalClimbDownFilm();
	void SetHitFilm();
	bool OnPlatform(void);
	virtual void CollisionAction(Sprite *s);
	bool OnSamePlatform(Platform *);
	bool areNear(Rect rect);
	bool isHigher(Rect rect);
	void ThrowBottle(void);
	void ChangeDirection(void);
	void GoToPopeye(void);
	void RunAway(void);
	void SetHit(bool hit) { isHit = hit; };
	bool IsHit(void) { return isHit; };
};

#endif